#ifndef _SEARCH_INCLUDED_
#define _SEARCH_INCLUDED_

#include "types.hpp"

class FS;
class Enumerator:public QThread
{
	FS *fs;
	QList<QString> *dirs;
	QList<QString> *files;
	
public:
	Enumerator(FS *fs, QList<QString> *dirs, QList<QString>* files)
	{
		this->dirs = dirs;
		this->fs = fs;
		this->files = files;
	};

	void run();
private:
	void enumDir(QString path);
};

class Search:public QThread
{
	Q_OBJECT
	
	FS *fs;
	QList<QString> *files;
	QList<Hit> *hits;
	Keyword key;
	Hit hit;

public:
	Search(FS *fs, QList<QString> *files, Keyword key, QList<Hit> *hits)
	{
		this->key = key;
		this->fs = fs;
		this->files = files;
		this->hits = hits;
	};
	
	void run();

signals:
	void fileSearched(int pos);
	void hitFound(Hit* hit);

private:
	void searchFile(QString path);
};

#endif //_SEARCH_INCLUDED_
